function dx = plant(t,x)
dx = zeros(24,1);
%-------------------------参数实际值----------------------------
m = 1.12;   Ixx = 0.0119;   Iyy = 0.0119;   Izz = 0.0223;
b = 7.73213*10^(-6); d = 1.27513*10^(-7); Jr = 8.5*10^(-4);
l = 0.23;   g = 9.81;   w = 1000;
%--------------------------------------------------------------%
kp2 = 1.2;  kp3 = 1.2;  kp4 = 1.2;  kp1 = 5.62;
ki2 = 3.1;  ki3 = 3.1;  ki4 = 3.1;  ki1 = 7.2;
kd2 = 0.08; kd3 = 0.08; kd4 = 0.03; kd1 = 1.0;
beta2 = 1.0;beta3 = 1.0;beta4 = 3.0;beta1 = 2.0;
lamd2 = 1.2;lamd3 = 1.2;lamd4 = 4.0;lamd1 = 1.01;
alpha2 = 0.001;     alpha3 = 0.001;     alpha4 = 0.001;     alpha1 = 0.01;
fai2 = 0.01;     fai3 = 0.01;     fai4 = 0.001;     fai1 = 0.1;
%-----------------------系统使用的参数--------------------------
a1 = (Ixx-Izz)/Ixx;    a2 = Jr/Ixx;     a3 = (Izz-Ixx)/Iyy;       a4 = -Jr/Iyy;
a5 = (Ixx-Iyy)/Izz;         
b1 = l/Ixx;     b2 = l/Iyy;     b3 = 1/Izz;
%---------------------------变量简化----------------------------
x1 = x(1); x2 = x(2); x3 = x(3); x4 = x(4); x5 = x(5); x6 = x(6);
x7 = x(7); x8 = x(8); x9 = x(9); x10=x(10); x11=x(11); x12=x(12);
x13=x(13); x14=x(14); x15=x(15); x16=x(16); x17=x(17); x18=x(18);
x19=x(19); x20=x(20); x21=x(21); x22=x(22); x23=x(23); x24=x(24);
%---------------------------滑模变量----------------------------
s2 = x13;   ds2 = x14;
s3 = x15;   ds3 = x16;
s4 = x17;   ds4 = x18;
s1 = x19;   ds1 = x20;
%---------------------------自适应率----------------------------
gama2_h = x21;
gama3_h = x22;
gama4_h = x23;
gama1_h = x24;
%---------------------------期望位置----------------------------
x1d = 0;    dx1d = 0;   ddx1d = 0; % 
x3d = 0;    dx3d = 0;   ddx3d = 0;
x5d = 0;    dx5d = 0;   ddx5d = 0;
x7d = 5;    dx7d = 0;   ddx7d = 0;
%------------------------------误差-----------------------------
e2 = x1d - x1;      de2 = dx1d - x2;   
e3 = x3d - x3;      de3 = dx3d - x4;  
e4 = x5d - x5;      de4 = dx5d - x6;
e1 = x7d - x7;      de1 = dx7d - x8;
%------------------------------干扰-----------------------------
if(t>=5)
    kfai =  7+2*cos(2*pi/3*t);
    kth  =  7+2*cos(2*pi/3*t);
    kps  =  5+2*cos(  pi/2*t);
    kh   = 18+4*cos(  pi/6*t);
else
    kfai =  0;
    kth  =  0;
    kps  =  0;
    kh   =  0;
end
% kfai =  7+2*cos(2*pi/3*t);
% kth  =  7+2*cos(2*pi/3*t);
% kps  =  5+2*cos(  pi/2*t);
% kh   = 18+4*cos(  pi/6*t);
%-----------------------控制输入----------------------
U2 = 1/(kd2*b1)*( -beta2*ds2 + kp2*de2 + ki2*e2 + kd2*(ddx1d-x4*x6*a1-x4*a2*w) + lamd2*s2 + gama2_h * saturate(ds2/fai2,-1,1) );
U3 = 1/(kd3*b2)*( -beta3*ds3 + kp3*de3 + ki3*e3 + kd3*(ddx3d-x2*x6*a3-x2*a4*w) + lamd3*s3 + gama3_h * saturate(ds3/fai3,-1,1) );
U4 = 1/(kd4*b3)*( -beta4*ds4 + kp4*de4 + ki4*e4 + kd4*(ddx5d-x2*x4*a5        ) + lamd4*s4 + gama4_h * saturate(ds4/fai4,-1,1) );

U1 = -m/( kd1*cos(x1)*cos(x3) )*( -beta1*ds1 + kp1*de1 + ki1*e1 + kd1*(ddx7d-g) + lamd1*s1 + gama1_h * saturate(ds1/fai1,-1,1) );
%-----------------------系统--------------------------
dx(1)  = x2;
dx(2)  = a1*x4*x6 + a2*w*x4 + b1*U2 + kfai;
dx(3)  = x4;
dx(4)  = a3*x2*x6 + a4*w*x2 + b2*U3 + kth;
dx(5)  = x6;
dx(6)  = a5*x2*x4 + b3*U4 + kps;
dx(7)  = x8;
dx(8)  = g - (1/m)*( cos(x1)*cos(x3) )*U1 + kh;
dx(9)  = x10;
dx(10) = ( cos(x1)*sin(x3)*cos(x5)+sin(x1)*sin(x5) )*U1/m;
dx(11) = x12;
dx(12) = ( cos(x1)*sin(x3)*sin(x5)-sin(x1)*cos(x5) )*U1/m;
%------------------------滑模系统-------------------------
% x13 = s2  x15 = s3   x17 = s4     x19 = s1
dx(13) = x14;
dx(14) = -lamd2*s2 - gama2_h*saturate(ds2/fai2,-1,1) - kd2*kfai;
dx(15) = x16;
dx(16) = -lamd3*s3 - gama3_h*saturate(ds3/fai3,-1,1) - kd3*kth;
dx(17) = x18;
dx(18) = -lamd4*s4 - gama4_h*saturate(ds4/fai4,-1,1) - kd4*kps;
dx(19) = x20;
dx(20) = -lamd1*s1 - gama1_h*saturate(ds1/fai1,-1,1) - kd1*kh;
%---------------------------自适应控制率--------------------
dx(21) = 1/alpha2*abs(ds2);
dx(22) = 1/alpha3*abs(ds3);
dx(23) = 1/alpha4*abs(ds4);
dx(24) = 1/alpha1*abs(ds1);
%----------------------------------------------------------
dx = [dx(1);dx(2);dx(3);dx(4);dx(5);dx(6);dx(7);dx(8);dx(9);dx(10);dx(11);dx(12);
      dx(13);dx(14);dx(15);dx(16);dx(17);dx(18);dx(19);dx(20);dx(21);dx(22);dx(23);dx(24)];


end